<?php
/**
 * Created by PhpStorm.
 * User: DaibiDaddy
 * Date: 2016/6/3
 * Time: 14:59
 */

namespace App\Setting\LazyCommon;

use App\Base\ViewsInList;

class AdminLogSetting{

    /*手动获取的配置项*/
    public $catType = "level";//Options:level snake
    public $entityCnName = "资讯";//模块名称
    public $table = "AdminLog";//数据表名称
    public $editKeys = array('id','uid','addDate','content','request');//后台管理列表中可以直接编辑的字段
    public $perPage = 10;//后台管理列表中可以直接编辑的字段

    /*自动获取的配置项*/
    public $bundleName;
    public $entityName;
    public $SettingPath;
    public $entityPath;
    public $entity;
    public $modelPath;
    public $em;

    public function __construct($em)
    {
        $this->bundleName = "App";
        $this->entityName = str_replace("\\","",str_replace("Setting","",str_replace(__NAMESPACE__,"",__CLASS__)));
        $this->SettingPath = __CLASS__;
        $this->entityPath = str_replace($this->entityName."Entity",$this->entityName,str_replace("Setting","Entity",__CLASS__));
        $this->entityPath = str_replace($this->entityName."Entity",$this->entityName,str_replace("Setting","Entity",str_replace("\\LazyCommon","",__CLASS__)));
        $this->entity = new $this->entityPath();
        $this->modelPath = str_replace("Setting","Model",__CLASS__);
        $this->em = $em;
    }

    public function listConfig()
    {
        $default = array();
        $default["Admin_Log AS AdminLog"]["select"] = array('id','uid','add_Date','content','request');
        $default["Admin_Log AS AdminLog"]["search"] = array('id','uid','add_Date','content','request');
        $default["Admin_Log AS AdminLog"]["condition"] = array('id','uid','add_Date','content','request');
        $default["Admin_Log AS AdminLog"]["orderBy"] = array('id'=>"DESC");

        $join = array();
        $join["User AS User"]["on"] = "User.id = AdminLog.uid ";
        $join["User AS User"]["select"] = array("account");
        $join["User AS User"]["search"] = array("account");
        $join["User AS User"]["condition"] = array();
        $join["User AS User"]["orderBy"] = array();

        return array(
            "default"   => $default,
            "joins"     => $join,
        );
    }

    public function viewConfig()
    {

    }


    public function formConfig()
    {
        
        $config["uid"] = array(
            "label"     =>"uid",
            "showType"  =>"text",
            "dataType"  =>"",
            "class"     =>"",
            "option"    => []
        );
        $config["addDate"] = array(
            "label"     =>"adddate",
            "showType"  =>"date",
            "dataType"  =>"",
            "class"     =>"",
            "option"    => []
        );
        $config["content"] = array(
            "label"     =>"内容",
            "showType"  =>"textarea",
            "dataType"  =>"",
            "class"     =>"",
            "option"    => []
        );
        $config["request"] = array(
            "label"     =>"request",
            "showType"  =>"text",
            "dataType"  =>"",
            "class"     =>"",
            "option"    => []
        );
        return $config;
    }
}